/*
 * @Description:静态内部类
 * 
 * @Author: rendc
 * 
 * @Date: 2025-08-06 11:02:52
 * 
 * @LastEditors: rendc
 * 
 * @LastEditTime: 2025-08-06 11:16:57
 */
// 外部类
public class StaticOuter {
  // 外部类变量
  private int outer_num = 10;
  private static int static_outer_num = 20;

  // 静态内部类
  static class Inner {
    // 内部类属性
    private int inner_num = 30;
    // static内部类中可以定义static属性和方法
    private static int static_inner_num = 40;

    // static内部类中只能访问外部类中的static属性和方法【静态访问静态】
    public static void staticFun() {
      // System.out.println("内部类：outer_num=" + outer_num);
      System.out.println("内部类：static_outer_num=" + static_outer_num);
      System.out.println("内部类：StaticOuter.static_outer_num=" + StaticOuter.static_outer_num);
      // 静态内部类中静态方法不能访问非静态成员
      // System.out.println(inner_num);
    }

    void show() {
      // 静态内部类中只能访问外部类的静态成员属性和方法
      // System.out.println("内部类：outer_num=" + outer_num);
      System.out.println("内部类：static_outer_num=" + static_outer_num);
      System.out.println(inner_num);
    }
  }

  public void disp() {
    Inner inner = new Inner();
    System.out.println(inner.inner_num);
    System.out.println(inner.static_inner_num);
  }
}